﻿using System;
using System.Collections.Generic;
  
class MatrixNxN_A
{
    static public void printmatrix(int[,] matr)
    {
        for (int i = 0; i < matr.GetLength(0); i++)
        {
            for (int j = 0; j < matr.GetLength(1); j++)
            {
                Console.Write("{0,4}",matr[i,j]);
            }
            Console.WriteLine();
        }
    }
        static void Main()
        {
            Console.WriteLine("Enter the dimention of the matrix:");
            int dimention = int.Parse(Console.ReadLine());           
            int[,] Matrix = new int[dimention,dimention];
            int i = 1;
            for(int col = 0;col< Matrix.GetLength(1); col++)
            {
                for(int row = 0;row < Matrix.GetLength(0); row++)
                {
                    Matrix[row,col] = i;
                    i++;
                }
            }
            Console.WriteLine();
            printmatrix(Matrix);
            Console.WriteLine();
        }

    }


